/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.academico.modelo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Tatiana
 */
@Entity
@Table(name = "tipos_de_identificacion", catalog = "academico", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TiposDeIdentificacion.findAll", query = "SELECT t FROM TiposDeIdentificacion t"),
    @NamedQuery(name = "TiposDeIdentificacion.findByTipo", query = "SELECT t FROM TiposDeIdentificacion t WHERE t.tipo = :tipo"),
    @NamedQuery(name = "TiposDeIdentificacion.findByDescripcio", query = "SELECT t FROM TiposDeIdentificacion t WHERE t.descripcio = :descripcio")})
public class TiposDeIdentificacion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 3)
    @Column(nullable = false, length = 3)
    private String tipo;
    @Size(max = 50)
    @Column(length = 50)
    private String descripcio;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoIdentificacion")
    private Collection<Docentes> docentesCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoIdentificacion")
    private Collection<Estudiantes> estudiantesCollection;

    public TiposDeIdentificacion() {
    }

    public TiposDeIdentificacion(String tipo) {
        this.tipo = tipo;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public String getDescripcio() {
        return descripcio;
    }

    public void setDescripcio(String descripcio) {
        this.descripcio = descripcio;
    }

    @XmlTransient
    public Collection<Docentes> getDocentesCollection() {
        return docentesCollection;
    }

    public void setDocentesCollection(Collection<Docentes> docentesCollection) {
        this.docentesCollection = docentesCollection;
    }

    @XmlTransient
    public Collection<Estudiantes> getEstudiantesCollection() {
        return estudiantesCollection;
    }

    public void setEstudiantesCollection(Collection<Estudiantes> estudiantesCollection) {
        this.estudiantesCollection = estudiantesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tipo != null ? tipo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TiposDeIdentificacion)) {
            return false;
        }
        TiposDeIdentificacion other = (TiposDeIdentificacion) object;
        if ((this.tipo == null && other.tipo != null) || (this.tipo != null && !this.tipo.equals(other.tipo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.academico.dao.TiposDeIdentificacion[ tipo=" + tipo + " ]";
    }
    
}
